package Exercicio1e2;


import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/ex01")
public class ServletExercicio01 extends HttpServlet {

	private static final long serialVersionUID = 1L;
	
	public void doGet(HttpServletRequest request, HttpServletResponse response){
		
		response.setContentType("text/html");	
		PrintWriter saida;
		Integer numero=Integer.parseInt(request.getParameter("numero"));
		
		try {
			saida=response.getWriter();
			
			saida.println("<html><body>");
			saida.println("<table border=\"2\">");
			saida.println("<tr><td>Número*</td><td>Valor</td><td>Resultado</td></tr>");
			
			for(int i=0;i<=10;i++){
				saida.println("<tr><td>"+numero+"</td><td>"+i+"</td><td>"+numero*i+"</td></tr>");
			}
			
			saida.println("</table");
			saida.println("</html></body>");
			
			saida.close();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}